
export default class PaletteProvider{
    private create: any;
    private elementFactory: any;
    private handTool: any;
    static $inject: string[];
    private moddle: any;
    private bpmnFactory: any;

    constructor(palette, create, elementFactory, handTool,moddle,bpmnFactory) {
        this.create = create
        this.elementFactory = elementFactory
        this.handTool = handTool
        this.moddle = moddle
        this.bpmnFactory = bpmnFactory

        palette.registerProvider(this)
    }

    getPaletteEntries(element){
        const {
            create,
            elementFactory
        } = this;
        function createTask() {
            return function(event) {
                const shape = elementFactory.createShape({
                    type: 'bpmn:Task'
                });

                create.start(event, shape);
            }
        }
        return {
            "hand-tool": {
                group: "tools",
                className: "bpmn-icon-hand-tool",
                title: "移动",
                action: {
                    click: (event)=>{
                        console.log(event)
                        this.handTool.activateHand(event)
                    }
                }
            },
            'create.task': {
                group: 'model',
                className: 'iconfont bjx-zhiwei',
                title: '用户事件',
                action: {
                    dragstart: createTask(),
                    click: createTask()
                }
            }
        }
    }

}
PaletteProvider.$inject = [
    'palette',
    'create',
    'elementFactory',
    'handTool',
    'moddle',
    'bpmnFactory'

]

